﻿namespace IBTrader.Indicator
{
    using IBTrader.Modules.Read;
    using IBTrader.Charts;
    using System;

    abstract class BaseUpDown : Base, IUpDown
    {
        public event EventHandler<Line> Up, Down;
        protected BaseUpDown(Worker worker, int group0 = 0, int group1 = 1) : base(worker, new ChartArgs { Group = group0 })
        {
            base.chartArgs.Add(ChartArgs.EventType.Up, new ChartArgs { Group = group1 });
            base.chartArgs.Add(ChartArgs.EventType.Down, new ChartArgs { Group = group1 });
        }
        protected virtual void OnUp(Line line, double price)
        {
            OnHit(Up, ChartArgs.EventType.Up, line, price);
        }
        protected virtual void OnDown(Line line, double price)
        {
            OnHit(Down, ChartArgs.EventType.Down, line, price);
        }
        protected virtual void OnUp(Line line)
        {
            OnHit(Up, ChartArgs.EventType.Up, line);
        }
        protected virtual void OnDown(Line line)
        {
            OnHit(Down, ChartArgs.EventType.Down, line);
        }
    }
}
